﻿#pragma once

#include <vector>
#include <stdexcept>
#include <cstdint>

namespace Server::MirForms::VisualMapInfo::Class
{
    class LockBitmap
    {
    private:
        std::vector<unsigned char> Pixels;
        int Depth = 0;
        int Width = 0;
        int Height = 0;

        Bitmap *source = nullptr;
        std::intptr_t Iptr = 0;
        BitmapData *bitmapData = nullptr;

    public:
        virtual ~LockBitmap()
        {
            delete source;
            delete bitmapData;
        }

        std::vector<unsigned char> getPixels() const;
        void setPixels(const std::vector<unsigned char> &value);
        int getDepth() const;
        void setDepth(int value);
        int getWidth() const;
        void setWidth(int value);
        int getHeight() const;
        void setHeight(int value);

        LockBitmap(Bitmap *source);

        void LockBits();

        void UnlockBits();

        Color *GetPixel(int x, int y);

        void SetPixel(int x, int y, Color *color);
    };
}
